<template>
  <TheEditForm
    ref="formRefs"
    title="新增退款"
    :options="refundFormOptions"
    :form.sync="refundForm"
    tip="提交后不可修改，请确认信息无误"
    @submit="submit"
  ></TheEditForm>
</template>

<script>
import TheEditForm from "@/components/TheCreateForm";
export default {
  components: {
    TheEditForm,
  },
  data() {
    return {
      refundForm: {},
      refundFormOptions: [
        {
          type: "select",
          field: "stockLibraryCode",
          title: "退款商家",
          default: "",
          placeholder: "请选择...",
          api: null,
          rules: [
            { required: true, message: "请选择合作商家", trigger: "change" },
          ],
        },

        {
          type: "input-number",
          field: "libraryName",
          title: "退款金额",
          default: "",
          placeholder: "请输入...",
          precision: 0,
          controls: false,
          max: 999999,
          min: 100,
          rules: [
            { required: true, message: "请输入充值金额...", trigger: "blur" },
            {
              trigger: "change",
              min: 100,
              max: 999999,
              message: "请输入100-999999范围内数字",
            },
          ],
        },
        {
          type: "select",
          field: "stockLibraryCode",
          title: "退款渠道",
          default: "",
          placeholder: "请选择...",
          options: [
            { label: "支付宝", value: "alipay" },
            { label: "微信", value: "weChat" },
            { label: "银行卡", value: "bank" },
            { label: "其他", value: "other" },
          ],
          rules: [{ required: true, message: "请选择...", trigger: "change" }],
        },
        {
          type: "upload",
          field: "libraryAddressDetail",
          title: "转账凭证",
          default: [],
          maxlength: 6,
          rules: [
            { required: true, message: "请上传转账凭证...", trigger: "change" },
          ],
        },
        {
          type: "textarea",
          field: "remark",
          title: "备注",
          default: "",
          maxlength: 40,
          placeholder: "备注...",
        },
      ],
    };
  },
  mounted() {},
  methods: {
    submit(formValue) {
      this.$emit("submit", formValue);
    },
    onShow() {
      this.$refs.formRefs.open();
    },
  },
};
</script>
